<?php
// 本类由系统自动生成，仅供测试用途
class TermAction extends Action {
	
	//查询栏目
	public function term(){
		//导航栏
		$nav = new PublicAction();
		$nav->base();
		//相关阅读
		$nav->reading();
		 $id['clid']=$_GET['id'];
		 $t=M('class');
		 $list = $t->where($id)->select();
		 $this->assign('term',$list);
		 //查找该栏目下内容分页
		 $cont=M('Content');
		 import('ORG.Util.Page');
		 $count      = $cont->where($id)->count();
		 $Page       = new Page($count,30);
		 $Page->setConfig('theme',' <span class="li_fist">%upPage%</span> %linkPage% <span class="li_last">%downPage%</span>');
		 $Page->setConfig('prev','<');
		 $Page->setConfig('next','>');
		 $show       = $Page->show();
		 $lists = $cont->where($id)->order('coid desc')->limit($Page->firstRow.','.$Page->listRows)->select();
		 $this->assign('content',$lists);
		 $this->assign('page',$show)->assign('count',$count);
		 $arr=array('25','26','27','24','104','31','32','33','34','35','36','37','38','39','40','41','42','43','79','85','87');
		 $pd=in_array($list[0]['clid'],$arr,true);
		 if($pd){
			 //单页		
			  $this->display();
              			  
		}else if($list[0]['clid']== 29){
				 $this->display('zhaopin_list');
				 
		}else if($list[0]['clid']== 3 || $list[0]['clid']== 5 || $list[0]['clid']== 6 || $list[0]['clid']== 8){
				 //查找对应内容图片
				 foreach($lists as $item)
				 $coidList[] = $item['coid'];
				 $m = M('textpic');
				 $map['coid'] = array('in', $coidList);
				 $pic = $m->where($map)->select();
				 foreach ($pic as $item)
				 $newpic[$item['coid']] = $item['tename'];
				 $this->assign("pic",$newpic);
				 $this->display('hd_list');
				 
		}else if($list[0]['clid']== 7 || $list[0]['clid']== 4){
				 $this->display('zixun_list');
				 
		}else if($list[0]['clid']== 23){
				//查找对应内容图片
				 foreach($lists as $item)
				 $coidList[] = $item['coid'];
				 $m = M('textpic');
				 $map['coid'] = array('in', $coidList);
				 $pic = $m->where($map)->select();
				 foreach ($pic as $item)
				 $newpic[$item['coid']] = $item['tename'];
				 $this->assign("pic",$newpic);
				 $this->display('qikan_list');
		}else if($list[0]['clid']== 28){
				 //查找对应内容图片
				 foreach($lists as $item)
				 $coidList[] = $item['coid'];
				 $m = M('textpic');
				 $map['coid'] = array('in', $coidList);
				 $pic = $m->where($map)->select();
				 foreach ($pic as $item)
				 $newpic[$item['coid']] = $item['tename'];
				 $this->assign("pic",$newpic);
				 $this->display('aboutusteam_list');
		}else if($list[0]['clid']== 21 || $list[0]['clid']== 22){
				//查找对应内容图片
				 foreach($lists as $item)
				 $coidList[] = $item['coid'];
				 $m = M('textpic');
				 $map['coid'] = array('in', $coidList);
				 $pic = $m->where($map)->select();
				 foreach ($pic as $item)
				 $newpic[$item['coid']] = $item['tename'];
				 $this->assign("pic",$newpic);
				 $this->display('zhuanjiashijiao_list');
		}else if($list[0]['clid']== 18){
					$c = M('_coid_clid');
				$list = $c->select();
				$count = $c->count();
				//dump($count);die;
				$this->assign('list',$list)->assign('count',$count);
				$m = M('content');
				foreach($list as $lists){
					$map['coid'] = $lists['coid'];
					$content[] = $m->where($map)->select();
				}				
				//echo $count;die;		
				//循环图片
				foreach($content as $item)
				 $coidList[] = $item[0]['coid'];
				 $m = M('textpic');
				 $map['coid'] = array('in', $coidList);
				 $pic = $m->where($map)->select();
				 foreach ($pic as $item)
				 $newpic[$item['coid']] = $item['tename'];
				 $this->assign("pic",$newpic);
				//分页显示
				foreach($content as $item)
				 $coidListc[] = $item[0]['coid'];
				 $cont=M('Content');
				 $mapa['coid'] = array('in', $coidListc);
				 import('ORG.Util.Page');
				 $count      = $cont->where($mapa)->count();
				 $Page       = new Page($count,30);
				 $Page->setConfig('theme',' <span class="li_fist">%upPage%</span> %linkPage% <span class="li_last">%downPage%</span>');
				 $Page->setConfig('prev','<');
				 $Page->setConfig('next','>');
				 $show       = $Page->show();
				 $lists = $cont->where($mapa)->order('coid desc')->limit($Page->firstRow.','.$Page->listRows)->select();
				 $this->assign('content',$lists)->assign('countn',$count);
				 $this->assign('page',$show);
				$this->display('case_list');
			 
		}else if($list[0]['clid']== 20){
			  //单页
				$id['clid']=97;
				$lists = $t->where($id)->select();
				$this->assign('content',$lists);
				$this->display();
		}else if($list[0]['clid']== 86){
			  $this->display('vip_page');
		}else if($list[0]['clid']== 81){
			 $this->display('question_list');
		}	 
	
	}	
	public function termcase(){
		
				if($_GET['id']>=49){
				$clid['clid']=$_GET['id'];
				
					$d=M('_coid_clid');
					$d=$d->where($clid)->select();
					foreach($d as $item)
					$dc[] = $item['coid'];
					$coid['coid']=array('in',$dc);
					$c=M('content');
					$content=$c->where($coid)->select();
					$count=count($content);
				}else{
				$coid['id']=$_GET['id'];
				$c=M('content');
				$content=$c->where($coid)->select();	
				$count=count($content);
				}
				//分页显示
				$c=M('content');
				import('ORG.Util.Page');
				 $Page       = new Page($count,30);
				 $Page->setConfig('theme',' <span class="li_fist">%upPage%</span> %linkPage% <span class="li_last">%downPage%</span>');
				 $Page->setConfig('prev','<');
				 $Page->setConfig('next','>');
				 $show       = $Page->show();
				 $lists = $c->where($coid)->order('coid desc')->limit($Page->firstRow.','.$Page->listRows)->select();
				 $this->assign('content',$content);
				 $this->assign('page',$show);
				 $this->assign('countn',$count); 
				 //图片
				foreach($content as $item)				
				$coidList[] = $item['coid'];			
				$m = M('textpic');
				$map['coid'] = array('in', $coidList);				 
				$pic = $m->where($map)->select();
				foreach ($pic as $item)
				$newpic[$item['coid']] = $item['tename'];
				$this->assign("pic",$newpic);
				//导航栏
				$nav = new PublicAction();
				$nav->base();
				//相关阅读
				$nav->reading();
				
				$this->display();
			}
	
	
}
	